﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DVSProject.Models.AccessModels>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    HandSoapDispenser
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<script type="text/javascript">
    $(function () {
        var pointHandSoapDispenserI =parseInt( $('#HandSoapDispenserRemarkPointI').val());

        TotalPoint();
        GetHandSoapDispenserRemarkI(false, pointHandSoapDispenserI);

        $('#HandSoapDispenserCheck').change(function () {
            var isChecked = $('#HandSoapDispenserCheck:checked').val() ? true : false;
            if (isChecked) {
                pointHandSoapDispenserI += 1;
            } else {
                pointHandSoapDispenserI -= 1;
            }
            $('#HandSoapDispenserRemarkPointI').val(pointHandSoapDispenserI);
            TotalPoint();

            if (pointHandSoapDispenserI == 1) {
                GetHandSoapDispenserRemarkI(false, pointHandSoapDispenserI);
            } else {
                GetHandSoapDispenserRemarkI(true, pointHandSoapDispenserI);
            }
        });

        function TotalPoint() {
            $("#TotalPoint").val(parseInt(pointHandSoapDispenserI));
        }

        function GetHandSoapDispenserRemarkI(isFilter, point) {
            var actionUrl = '<%=Url.Action("HandSoapDispenserRemarkIProcess","Access") %>'
            $.ajax({
                type: "GET",
                url: actionUrl,
                contentType: "application/json; charset=utf-8",
                data: ({ isFitter: isFilter }),
                success: function (data) {

                    $("#HandSoapDispenserRemarkI").html(data);

                    if (point < 1) {
                        $('#HandSoapDispenserRemarksI').removeAttr("disabled");
                    }
                },
                error: function (data) {
                    alert(data);
                    //SimilarSlider.html("<div style='color:#682929;text-align:center;font-weight:bold;'>¢Íâ·É¤èÐ ÃÐººäÁèÊÒÁÒÃ¶áÊ´§Ë¹éÒ¹Õéä´éã¹¢³Ð¹Õé</div>");
                }
            });
        }


    });

</script>
    <h2>
        Hand Soap Dispenser เครื่องจ่ายน้ำยาล้างมือ</h2>
    <% using (Html.BeginForm())
       {%>
    <%= Html.ValidationSummary(true) %>
    <div class="CSSTableGenerator">
        <table>
            <tr>
                <th>
                    <label>
                        Title</label>
                </th>
                <th>
                    <label>
                        Ok ดี</label>
                </th>
                <th>
                    <label>
                        Remarks หมายเหตุ</label>
                </th>
                <th>
                    <label>
                        Point คะแนน</label>
                </th>
            </tr>
            <tr>
                <td>
                    <label>
                        Hand Soap Dispenser กล่องสบู่ทุกจุด ทำงานปกติ</label>
                </td>
                <td align="center">
                    <%= Html.CheckBoxFor(model => model.HandSoapDispenserCheck)%>
                </td>
                <td>
                   <%-- <%=@Html.DropDownListFor(model => model.HandSoapDispenserRemarkI, Model.HandSoapDispenserRemarkISelect)%>--%>
                     <div id="HandSoapDispenserRemarkI">
                    </div>
                </td>
                <td align="center">
                    <%=@Html.TextBoxFor(model => model.HandSoapDispenserRemarkPointI, new { @Value = "1", @readonly = "true" })%>
                </td>
            </tr>
             <tr>
                <td colspan="3">
                    Total Points คะแนนรวม
                </td>
                <td>
                    <input type="text" id="TotalPoint" readonly="readonly" value="0" />
                </td>
            </tr>
        </table>
    </div>
    <p>
        <input type="submit" class="buttonSummit" value="Next" />
    </p>
    <% } %>
    <div>
        <%= Html.ActionLink("Back to List", "Index") %>
    </div>
</asp:Content>
